<?php
class guanzhuAction extends Action
{
	/**
	 * 会员想去时添加值
	 */
	function add()
	{
		
		$uid=$_COOKIE["uchome_uid"];
		$tid=$_REQUEST["tid"];
		$uchome_auth=$_COOKIE["uchome_auth"];
		if(!$uchome_auth) die("会员没有登陆");
		
		$mr=M("guanzhu");
		
		$rs=$mr->where("guanzhu1=$uid and guanzhu2=$tid")->find();
		if($rs)
		{
			die("这条线路已经是您想去的了");
		}
		$data["guanzhu1"]=$uid;
		$data["guanzhu2"]=$tid;
		$num=$mr->data($data)->add();
		
		if($num)
		{
			$rs=$mr->query("select count(*) as num from ".DQ."guanzhu where guanzhu2=$tid");
			echo $rs[0]["num"];
		}
		else
		{
			echo "添加失败";
		}
	}
}

?>